package com.imay.live.model;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.netease.nimlib.sdk.msg.constant.MsgStatusEnum;
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.RecentContact;

import java.util.Map;

import static com.imay.live.adapter.RecentContactAdapter.FAMILY;

/**
 * Created by Administrator on 2017/9/12.
 */

public class RecentFamilyModel implements MultiItemEntity {

    private String contactId;
    private String fromAccount;
    private String fromNick;
    private SessionTypeEnum sessionType;
    private String recentMessageId;
    private MsgTypeEnum msgType;
    private MsgStatusEnum msgStatus;
    private int unreadCount;
    private String content;
    private long time;
    private MsgAttachment attachment;
    private long tag;
    private  Map<String, Object> extension;

    public String getContactId() {
        return contactId;
    }

    public void setContactId(String contactId) {
        this.contactId = contactId;
    }

    public String getFromAccount() {
        return fromAccount;
    }

    public void setFromAccount(String fromAccount) {
        this.fromAccount = fromAccount;
    }

    public String getFromNick() {
        return fromNick;
    }

    public void setFromNick(String fromNick) {
        this.fromNick = fromNick;
    }

    public SessionTypeEnum getSessionType() {
        return sessionType;
    }

    public void setSessionType(SessionTypeEnum sessionType) {
        this.sessionType = sessionType;
    }

    public String getRecentMessageId() {
        return recentMessageId;
    }

    public void setRecentMessageId(String recentMessageId) {
        this.recentMessageId = recentMessageId;
    }

    public MsgTypeEnum getMsgType() {
        return msgType;
    }

    public void setMsgType(MsgTypeEnum msgType) {
        this.msgType = msgType;
    }

    public MsgStatusEnum getMsgStatus() {
        return msgStatus;
    }

    public void setMsgStatus(MsgStatusEnum msgStatus) {
        this.msgStatus = msgStatus;
    }

    public int getUnreadCount() {
        return unreadCount;
    }

    public void setUnreadCount(int unreadCount) {
        this.unreadCount = unreadCount;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public MsgAttachment getAttachment() {
        return attachment;
    }

    public void setAttachment(MsgAttachment attachment) {
        this.attachment = attachment;
    }

    public long getTag() {
        return tag;
    }

    public void setTag(long tag) {
        this.tag = tag;
    }

    public Map<String, Object> getExtension() {
        return extension;
    }

    public void setExtension(Map<String, Object> extension) {
        this.extension = extension;
    }

    @Override
    public int getItemType() {
        return FAMILY;
    }

    public static RecentFamilyModel getRecentFamilyModel(RecentContact recentContact){
        RecentFamilyModel familyModel = new RecentFamilyModel();
        familyModel.setExtension(recentContact.getExtension());
        familyModel.setAttachment(recentContact.getAttachment());
        familyModel.setContactId(recentContact.getContactId());
        familyModel.setContent(recentContact.getContent());
        familyModel.setFromAccount(recentContact.getFromAccount());
        familyModel.setFromNick(recentContact.getFromNick());
        familyModel.setMsgStatus(recentContact.getMsgStatus());
        familyModel.setMsgType(recentContact.getMsgType());
        familyModel.setRecentMessageId(recentContact.getRecentMessageId());
        familyModel.setSessionType(recentContact.getSessionType());
        familyModel.setTag(recentContact.getTag());
        familyModel.setTime(recentContact.getTime());
        familyModel.setUnreadCount(recentContact.getUnreadCount());
        return familyModel;
    }


}
